package com.test;

import java.util.Random;

public class grace3 extends grace1{
    @Override
    int random(double a, double b) {
        //实现随机运算符号，加法和减法,并输出算式
        Random random = new Random();
        int tmp = random.nextInt(4);
        switch (tmp) {
            case 0:
                System.out.println("本题为加法");
                System.out.println(a+"+"+b+"=");
                break;
            case 1:
                System.out.println("本题为减法");
                System.out.println(a+"-"+b+"=");
                break;
            case 2:
                System.out.println("本题为乘法");
                System.out.println(a+"*"+b+"=");
                break;
            case 3:
                System.out.println("本题为除法,运算结果保留三位小数");
                System.out.println(a+"/"+b+"=");
                break;
        }
        return tmp;
    }
}
